<?php


namespace App\Http\Controllers\Api;


use App\Http\Controllers\Controller;
use App\library\services\BuildingService;
use App\Models\Building;
use Illuminate\Http\Request;

class BuildingController extends Controller
{
    /**
     * Author:YangXinPeng
     * 热门楼盘
     * @param Request $request
     * @return array|mixed
     */
    public function hotBuilding(Request $request)
    {
        $province = $request->get('province');
        if (empty($province)) {
            return $this->fail('参数错误');
        }
        $res = BuildingService::getHotBuilding($province);
        return $res;
    }

    /**
     * Author:YangXinPeng
     * 楼盘列表
     * @param Request $request
     * @return array|mixed
     */
    public function buildings(Request $request)
    {
        $province = $request->get('province');
        if (empty($province)) {
            return $this->fail('参数错误');
        }
        $res = BuildingService::getBuilding($province);
        return $res;
    }


    public function building(Request $request)
    {
        $id = $request->get('id');
        $res = BuildingService::getBuildingById($id);
        return $res;
    }



}
